VERSION 5.00
Object = "{C932BA88-4374-101B-A56C-00AA003668DC}#1.1#0"; "MSMASK32.OCX"
Begin VB.Form fPassword 
   Appearance      =   0  'Flat
   BackColor       =   &H00C0C0C0&
   BorderStyle     =   3  'Fixed Dialog
   Caption         =   "Seguridad del Sistema"
   ClientHeight    =   6180
   ClientLeft      =   3480
   ClientTop       =   2805
   ClientWidth     =   8355
   BeginProperty Font 
      Name            =   "MS Sans Serif"
      Size            =   8.25
      Charset         =   0
      Weight          =   700
      Underline       =   0   'False
      Italic          =   0   'False
      Strikethrough   =   0   'False
   EndProperty
   ForeColor       =   &H80000008&
   Icon            =   "PASSWORD.frx":0000
   LinkTopic       =   "Form1"
   LockControls    =   -1  'True
   MaxButton       =   0   'False
   MinButton       =   0   'False
   PaletteMode     =   1  'UseZOrder
   Picture         =   "PASSWORD.frx":0442
   ScaleHeight     =   6180
   ScaleWidth      =   8355
   ShowInTaskbar   =   0   'False
   Begin VB.TextBox txtPassword 
      BorderStyle     =   0  'None
      BeginProperty Font 
         Name            =   "Arial"
         Size            =   11.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   300
      IMEMode         =   3  'DISABLE
      Left            =   5820
      MaxLength       =   8
      PasswordChar    =   "*"
      TabIndex        =   1
      Top             =   1710
      Width           =   1785
   End
   Begin VB.TextBox txtUser 
      BorderStyle     =   0  'None
      BeginProperty Font 
         Name            =   "Arial"
         Size            =   11.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   300
      Left            =   5820
      MaxLength       =   8
      TabIndex        =   0
      Top             =   1260
      Width           =   1785
   End
   Begin MSMask.MaskEdBox mskFecha 
      Height          =   315
      Left            =   6165
      TabIndex        =   2
      Top             =   2445
      Width           =   1440
      _ExtentX        =   2540
      _ExtentY        =   556
      _Version        =   393216
      BorderStyle     =   0
      ClipMode        =   1
      AutoTab         =   -1  'True
      Enabled         =   0   'False
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Format          =   "dd-mm-yyyy"
      PromptChar      =   "_"
   End
   Begin MSMask.MaskEdBox mskCambio 
      Height          =   315
      Index           =   0
      Left            =   6165
      TabIndex        =   3
      Top             =   2955
      Width           =   1440
      _ExtentX        =   2540
      _ExtentY        =   556
      _Version        =   393216
      BorderStyle     =   0
      ClipMode        =   1
      AutoTab         =   -1  'True
      Enabled         =   0   'False
      MaxLength       =   8
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Format          =   "##0.0000"
      PromptChar      =   "_"
   End
   Begin MSMask.MaskEdBox mskCambio 
      Height          =   300
      Index           =   3
      Left            =   6795
      TabIndex        =   4
      Top             =   240
      Visible         =   0   'False
      Width           =   1140
      _ExtentX        =   2011
      _ExtentY        =   529
      _Version        =   393216
      ClipMode        =   1
      AutoTab         =   -1  'True
      Enabled         =   0   'False
      MaxLength       =   11
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Format          =   "##0.0000"
      PromptChar      =   "_"
   End
   Begin MSMask.MaskEdBox mskCambio 
      Height          =   300
      Index           =   2
      Left            =   6795
      TabIndex        =   5
      Top             =   240
      Visible         =   0   'False
      Width           =   1140
      _ExtentX        =   2011
      _ExtentY        =   529
      _Version        =   393216
      ClipMode        =   1
      AutoTab         =   -1  'True
      Enabled         =   0   'False
      MaxLength       =   11
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Format          =   "##0.0000000"
      PromptChar      =   "_"
   End
   Begin MSMask.MaskEdBox mskCambio 
      Height          =   330
      Index           =   1
      Left            =   6165
      TabIndex        =   6
      Top             =   3450
      Width           =   1440
      _ExtentX        =   2540
      _ExtentY        =   582
      _Version        =   393216
      BorderStyle     =   0
      ClipMode        =   1
      AutoTab         =   -1  'True
      Enabled         =   0   'False
      MaxLength       =   8
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Format          =   "##0.0000"
      PromptChar      =   "_"
   End
   Begin VB.Label cmdOk 
      BackStyle       =   0  'Transparent
      Height          =   420
      Left            =   6270
      TabIndex        =   8
      Top             =   5355
      Width           =   1470
   End
   Begin VB.Label cmdExit 
      BackStyle       =   0  'Transparent
      Height          =   420
      Left            =   4665
      TabIndex        =   7
      Top             =   5355
      Width           =   1470
   End
   Begin VB.Image imgSeguro 
      Height          =   540
      Left            =   1995
      Stretch         =   -1  'True
      Top             =   120
      Width           =   630
   End
End
Attribute VB_Name = "fPassword"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim lBoton As Boolean
Private Sub cmdExit_Click()
    lBoton = True
    End
End Sub
Private Sub cmdOk_Click()
Dim strPwd As String
     Dim RS As ADODB.Recordset
    
    lBoton = True
    If txtUser = "" Then beep: MsgBox "Debe Ingresar Usuario", vbExclamation: txtUser.SetFocus: Exit Sub
    If txtPassword = "" Then beep: MsgBox "Debe Ingresar Password", vbExclamation: txtPassword.SetFocus: Exit Sub
    If Not ValidaFecha(mskFecha, 1980) Then mskFecha.SetFocus: Exit Sub
  
     Set CLS_Comando = New clsEjeComando
    ' Obtengo los Datos del Usuario
    Set RS = CLS_Comando.Ejec_Comando_1("sp_Glo_Trae_Datos_Usuario", gbSistema$, Trim$(txtUser))
    If RS.RecordCount > 0 Then RS.MoveLast: RS.MoveLast
    
    If RS.RecordCount > 0 Then
        strPwd = Trim$(RS("Clave"))
        strPwd = objFn.DesEncriptar(strPwd)
        If strPwd = Trim$(txtPassword.Text) Then
            imgSeguro.Picture = LoadPicture()
            If Dir(PathApp() & "Icons\secur01a.ico") <> "" Then
               imgSeguro.Picture = LoadPicture(PathApp() & "Icons\secur01a.ico")
            End If
            imgSeguro.Refresh
            beep
            ' Capturo Nombre de Usuario y Tipo de Cambio
            gbNameUser$ = Trim$(txtUser)
            ' Capturo los Valores de la Contabilidad
            gbPeriodo$ = RS("Periodo")
            gbAno$ = Left$(gbPeriodo$, 4)
            gbMes$ = Right$(gbPeriodo$, 2)
            gbTipoImpre$ = aTexto(RS("TipoImp"))
            gbAccPerCerr$ = aTexto(RS("AccPerCerr"))
            gbtVListaPrecio = aTexto(RS("VerListaPrecios"))
            Unload Me
        Else
            beep
            lBoton = False
            MsgBox "Password Incorrecto", vbCritical
            txtPassword = "": txtPassword.SetFocus
        End If
    Else
        beep
        lBoton = False
        MsgBox "Usuario No Registrado", vbCritical
        
        txtUser = "": txtPassword = "": txtUser.SetFocus
    End If
    
    ' Cierro el recordset
    RS.Close
    Set RS = Nothing
    
End Sub
Private Sub Form_Load()

    ' Coloco el Puntero en Espera
    Call PunteroRelojDeArena

    ' Instancio el Objeto de Seguridad
    Set objFn = New SeguridadLib.clsFuncion
    
    ' Instancia el Objeto
    Set objIni = New SeguridadLib.clsIni
    
    ' Obtengo los Ultimos Tipos de Cambio
    For i% = 0 To 3
        cTipCam$ = Choose(i% + 1, "B", "B", "C", "S")
        cValCam$ = Choose(i% + 1, "C", "V", "", "")
        Set CLS_Comando = New clsEjeComando
        Call CLS_Comando.Ejec_Comando_2("sp_Glo_Trae_Ultimo_TiCambio", cTipCam$, cValCam$, 0)
        mskCambio(i%) = Cmd(3)
    Next i%
    
    ' Inicializo Icono de Seguridad, Fecha y Posicion de Pantalla
    If Dir(PathApp() & "Icons\secur01b.ico") <> "" Then
        imgSeguro.Picture = LoadPicture(PathApp() & "Icons\secur01b.ico")
    End If
    mskFecha = Format(Date, "dd/mm/yyyy")
    Call CentraPantalla(Me)
    
    gbBaseDatos$ = "premium"
    
    ' Coloco el Puntero Normal
    Call PunteroNormal
        
End Sub
Private Sub Form_Unload(Cancel As Integer)

    imgSeguro.Picture = LoadPicture()
    If Not lBoton Then End
    
End Sub


Private Sub mskFecha_GotFocus()

    Call MarcaGet(mskFecha)

End Sub
Private Sub mskFecha_KeyPress(KeyAscii As Integer)

    If KeyAscii = 13 And mskFecha.ClipText <> "" Then cmdOk_Click
    
End Sub
Private Sub txtPassword_GotFocus()

    Call MarcaGet(txtPassword)

End Sub
Private Sub txtPassword_KeyPress(KeyAscii As Integer)

    If KeyAscii = 13 And Len(txtPassword) > 0 Then
        cmdOk_Click
        KeyAscii = 0
    End If
    
End Sub
Private Sub txtUser_GotFocus()

    Call MarcaGet(txtUser)

End Sub


Private Sub txtUser_KeyPress(KeyAscii As Integer)

    If KeyAscii = 13 And Len(txtUser) > 0 Then
        txtPassword.SetFocus
        KeyAscii = 0
    End If
    
End Sub
